package secretaryGUI;

import java.awt.Color;

import javax.swing.table.JTableHeader;

import guiCode.secretaryScreenCode;

public class editExistingClass {

	secretaryScreenCode ssc;
	secretaryAlerts sa = new secretaryAlerts();

	public void buttonClick(secretaryScreenCode code, createSecretaryWindow csw) {
		ssc = code;
		if (csw.btnEditExistingClass.getText().equals("Edit existing class")) {
			JTableHeader header = csw.table.getTableHeader();
			header.setBackground(Color.GREEN);
			JTableHeader header1 = csw.table_1.getTableHeader();
			header1.setBackground(Color.YELLOW);
			csw.alertsLbl.setText("Click on 'className field to edit the class name. Click on 'classID' field to get all the students in the selected class");
			csw.btnViewExistingClasses.setEnabled(false);
			csw.btnCreateNewClass.setEnabled(false);
			csw.table.setEnabled(true);
			csw.btnEditExistingClass.setText("Stop edit mode");
			csw.btnEditExistingClass.setForeground(Color.RED);
			//csw.btnRemoveStudentFrom.setEnabled(true);
			//csw.btnAddStudentTo.setEnabled(true);
			csw.alertsLbl.setText("Click on classID field to add/remove students from class. Click on className to change the class name");
		} else {
			if (csw.btnEditExistingClass.getText().equals("Stop edit mode")) {
				ssc.setEditMode(-1);
				csw.lblUP.setText("");
				JTableHeader header = csw.table.getTableHeader();
				header.setBackground(Color.YELLOW);
				JTableHeader header1 = csw.table_1.getTableHeader();
				header1.setBackground(Color.YELLOW);
				csw.btnRemoveStudentFrom.setForeground(Color.BLACK);
				csw.alertsLbl.setText("Click on 'View existing classes' to view all the classes in this semester");
				csw.btnEditExistingClass.setEnabled(false);
				csw.btnCreateNewClass.setEnabled(false);
				csw.btnViewExistingClasses.setEnabled(true);
				ssc.backToDefault(csw,ssc);
				csw.table.setEnabled(false);
				csw.btnAddStudentTo.setForeground(Color.BLACK);
				csw.btnEditExistingClass.setText("Edit existing class");
				csw.btnEditExistingClass.setForeground(Color.BLACK);
				csw.btnRemoveStudentFrom.setEnabled(false);
				csw.btnAddStudentTo.setEnabled(false);
			}
		}
	}
}
